﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
using JSTT_DATA_ENTITY;
using JSTT_DATA_ENTITY.XMLDatas;
using log4net;

namespace JSTT_SEV_PROJECT
{
   
    class Program
    {

        static void ReadElementXml()
        {
        }

        static void Main(string[] args)
        {

            THRecieveDevDatas revDevDatas = new THRecieveDevDatas();
            THProcessDeviceData processDeviceData = new THProcessDeviceData();

            // 定时线程，负责定时数据查看和递交
            int timeRate = Convert.ToInt16(System.Configuration.ConfigurationManager.AppSettings["PROCESSWAITINGTIME"].ToString());
            Timer t1 = new System.Threading.Timer(processDeviceData.DataProcessTimeAction, null, TimeSpan.FromSeconds(20), TimeSpan.FromMinutes(timeRate));

            // 接收数据的线程，负责Socket数据接收
            Thread RecivedSocketData = new Thread(revDevDatas.ReceiveSocketDatas);
            RecivedSocketData.Name = "ReciveSocketData";
            RecivedSocketData.Start();

            // 处理数据的线程，负责数据的处理
            Thread ProcessMessageData = new Thread(processDeviceData.ReceiveMessages);
            ProcessMessageData.Name = "ProcessSocketData";
            ProcessMessageData.Start();

            RecivedSocketData.Join();
            ProcessMessageData.Join();
        }
    }
}
